<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2009-12-13T00:00:00" />
    </reg:owner>
  </owners>

  <number>90701</number>

  <name>Function test for xfi:format-number</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi: format-number($value as numeric?, $picture as xs:string) as xs:string
    </xhtml:p>
    <xhtml:p>
      The test cases below assume 'en' globalization settings, e.g., '.' for decimals point, ',' for thousands
      separator.
    </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666"/>
  <reference xlink:type="simple" xlink:href="http://www.w3.org/TR/xslt20/#format-number"/>

  <variation id="V-01">
    <name>Zero-absent integer case, nonzero</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V01" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V01">
        xfi:format-number(123456, "#")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '123456'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Zero-absent integer case, zero</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V02" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V02">
        xfi:format-number(0, "#")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '0'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Zero-present integer case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V03" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V03">
        xfi:format-number(0, "0")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '0'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Decimals case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V04" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V04">
        xfi:format-number(123456, "#.00")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '123456.00'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Thousands separator case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V05" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V05">
        xfi:format-number(123456, "###,###.00")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '123,456.00'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Percent case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V06" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V06">
        xfi:format-number(.1234, "#.00%")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq '12.34%'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Empty sequence input case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V07" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V07">
        xfi:format-number((), "0")
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq 'NaN'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-08">
    <name>Non-numeric input case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V08" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V08">
        xfi:format-number("hello world", "0")
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xqt-err:XPTY0004</error>
    </outputs>
  </variation>

  <variation id="V-09">
    <name>Picture syntax error case</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09" xlink:type="simple" xlink:href="default.xsd"/>
     <cfcn:call file="V09">
        xfi:format-number(123456,"hello world")
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidPictureSyntax</error>
    </outputs>
  </variation>


  <revisions>
    <reg:revision on="2009-12-13T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-10-27T12:00:00" by="herm">
      <xhtml:p>
        Fixed issues raised by Okumura-san.
      </xhtml:p>
    </reg:revision>

  </revisions>

</testcase>





